package com.glsc.ngateway.common.base.repo.mysql.gateway.platform;


import com.glsc.ngateway.common.base.domain.mysql.gateway.platform.flow.FlowFormEventImprove;
import com.glsc.ngateway.common.api.flowable.dto.FlowParamSearchDto;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 整改流程的表单数据服务类
 * * * * */
@Repository
public interface FlowFormEventImproveRepo extends JpaRepository<FlowFormEventImprove, String>, JpaSpecificationExecutor<FlowFormEventImprove> {

    //根据流程Id检索表单
    FlowFormEventImprove findByProcessId(String processId);

    List<FlowFormEventImprove> findByIsCloseAndPlanDateIn(int isClose, List<String> planDate);

    @Query(value = "select m from FlowFormEventImprove m  where 1=1 " +
            "and (:#{#paramSearchDto.processId} is null OR m.fromEventProcessId = :#{#paramSearchDto.processId})  " )
    Page<FlowFormEventImprove> searchByParam(Pageable pageable, FlowParamSearchDto paramSearchDto);

    List<FlowFormEventImprove> findByIsClose(int noClose);

    List<FlowFormEventImprove> findAllByFromEventProcessId(String processId);
}
